#include "SDL.h"
#include "SDL_image.h"
#include "SDL_net.h"
#include <string> 

#include "image.h"
#include "load.h"
#include "data.h"

//The surfaces that will be used 
SDL_Surface *message = NULL; 
SDL_Surface *screen = NULL; 

int main( int argc, char* argv[] )
{
//Initialize all SDL subsystems 
	if( SDL_Init( SDL_INIT_EVERYTHING ) == -1 ) 
	{ 
		return 1; 
	} 
	//Set up the screen 
	screen = SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_SWSURFACE ); 

	//If there was an error in setting up the screen 
	if( screen == NULL ) 
	{ 
		return 1; 
	} 
	//Set the window caption 
	SDL_WM_SetCaption( "MORTUIS", NULL ); 

	// initialize (will be moved to initialize tab as a new c++ file)
	loadTextures();
	loadBackgrounds();
	loadCharacters();
	map[0]=loadMap("data/maps/viagul.txt");

	// show the map on the screen
	displayMap(0 , screen);
	// show the character on the screen at a point
	displayChar(4,4,3,screen);

	//Update the screen 
	if( SDL_Flip( screen ) == -1 ) 
	{ 
		return 1; 
	}

	//Wait 5 seconds 
	SDL_Delay( 5000 );

	//Free the surfaces 
	SDL_FreeSurface( message ); 
	//SDL_FreeSurface( background ); 
	//Quit SDL 
	SDL_Quit(); 
	//Return 
	return 0;  

}
